package com.jsyl.lwbk.business.service.impl;

import com.jsyl.lwbk.business.domain.BasicInformation;
import com.jsyl.lwbk.business.domain.Child;
import com.jsyl.lwbk.business.dto.CheckDTO;
import com.jsyl.lwbk.business.mapper.BasicInformationMapper;
import com.jsyl.lwbk.business.mapper.ChildMapper;
import com.jsyl.lwbk.business.service.IChildInformationService;
import com.jsyl.lwbk.business.vo.BasicInformationVO;
import com.jsyl.lwbk.common.utils.AgeUtils;
import com.jsyl.lwbk.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class ChildInformationServiceImpl implements IChildInformationService {

    @Autowired
    BasicInformationMapper basicInformationMapper;
    @Autowired
    ChildMapper childMapper;

    @Override
    public BasicInformationVO getInformation(Long childId) {
        BasicInformationVO vo = new BasicInformationVO();
        Child child = childMapper.selectById(childId);

        BasicInformation basicInformation = basicInformationMapper.selectByChildId(childId);
        vo.setChildId(childId);
        vo.setChildName(child.getName());
        vo.setChildSex(child.getSex().toString());
        vo.setChildAge(AgeUtils.buildAge(child.getBirthYear(), child.getBirthMonth(), child.getBirthDay()));

        if (basicInformation != null) {
            vo.setId(basicInformation.getId());
            vo.setParentName(checkNull(basicInformation.getParentName()));
            vo.setParentPhone(checkNull(basicInformation.getParentPhone()));
            vo.setParentAge(basicInformation.getParentAge() != null ? basicInformation.getParentAge() : null);
            vo.setParentJob(checkNull(basicInformation.getParentJob()));
            vo.setLearnSituation(basicInformation.getLearnSituation() != null ? basicInformation.getLearnSituation() : null);
            vo.setLearnSituationRemark(checkNull(basicInformation.getLearnSituationRemark()));
            vo.setFamilySort(basicInformation.getFamilySort() == null ? null : basicInformation.getFamilySort());
            vo.setMainLanguage(checkNull(basicInformation.getMainLanguage()).split(","));
            vo.setMainLanguageRemark(checkNull(basicInformation.getMainLanguageRemark()));
            vo.setMedicalDiagnosis(checkNull(basicInformation.getMedicalDiagnosis()).split(","));
            vo.setMedicalDiagnosisRemark(checkNull(basicInformation.getMedicalDiagnosisRemark()));
            vo.setFamilyHereditaryDisease(checkNull(basicInformation.getFamilyHereditaryDisease()).split(","));
            vo.setHereditaryDiseaseRemark(checkNull(basicInformation.getHereditaryDiseaseRemark()));
            vo.setPregnantSituation(checkNull(basicInformation.getPregnantSituation()).split(","));
            vo.setPregnantMedicine(checkNull(basicInformation.getPregnantMedicine()));
            vo.setPregnantSituationRemark(checkNull(basicInformation.getPregnantSituationRemark()));
            vo.setAbnormalThyroidFunction(checkNull(basicInformation.getAbnormalThyroidFunction()));
            vo.setPregnantEmotion(checkNull(basicInformation.getPregnantEmotion()).split(","));
            vo.setPregnantEmotionRemark(checkNull(basicInformation.getPregnantEmotionRemark()));
            vo.setProductionMethod(basicInformation.getProductionMethod() == null ? null : basicInformation.getProductionMethod());
            vo.setProductionSpecialSituation(checkNull(basicInformation.getProductionSpecialSituation()).split(","));
            vo.setAfterProductionSituation(checkNull(basicInformation.getAfterProductionSituation()).split(","));
            vo.setAfterProductionRemark(checkNull(basicInformation.getAfterProductionRemark()));
            vo.setMainCaregiver(checkNull(basicInformation.getMainCaregiver()).split(","));
            vo.setAccidentPhysicalInjury(checkNull(basicInformation.getAccidentPhysicalInjury()).split(","));
            vo.setPhysicalInjuryRemark(checkNull(basicInformation.getPhysicalInjuryRemark()));
            vo.setAccidentFamilyChanges(checkNull(basicInformation.getAccidentFamilyChanges()).split(","));
            vo.setFamilyChangesRemark(checkNull(basicInformation.getFamilyChangesRemark()));
            vo.setOneTypeVaccines(checkNull(basicInformation.getOneTypeVaccines()).split(","));
            vo.setTwoTypeVaccines(checkNull(basicInformation.getTwoTypeVaccines()).split(","));
            vo.setOtherVaccines(checkNull(basicInformation.getOtherVaccines()));
            vo.setFoodAllergy(checkNull(basicInformation.getFoodAllergy()).split(","));
            vo.setFoodAllergyRemark(checkNull(basicInformation.getFoodAllergyRemark()));
            vo.setBreathAllergy(checkNull(basicInformation.getBreathAllergy()).split(","));
            vo.setBreathAllergyRemark(checkNull(basicInformation.getBreathAllergyRemark()));
            vo.setContactAllergy(checkNull(basicInformation.getContactAllergy()).split(","));
            vo.setContactAllergyRemark(checkNull((basicInformation.getContactAllergyRemark())));
            vo.setLimbDeletion(checkNull(basicInformation.getLimbDeletion()).split(","));
            vo.setLimbDeletionRemark(checkNull(basicInformation.getLimbDeletionRemark()));
            vo.setMedicalExamination(checkNull(basicInformation.getMedicalExamination()).split(","));
            vo.setMedicalExaminationRemark(checkNull((basicInformation.getMedicalExaminationRemark())));
            //
            vo.setMainLanguageList(selectMainLanguageList(checkNull(basicInformation.getMainLanguage())));//
            vo.setMedicalDiagnosisList(selectMedicalDiagnosisList(checkNull(basicInformation.getMedicalDiagnosis())));
            vo.setFamilyHereditaryDiseaseList(selectFamilyHereditaryDiseaseList(checkNull(basicInformation.getFamilyHereditaryDisease())));
            vo.setPregnantSituationList(selectPregnantSituationList(checkNull(basicInformation.getPregnantSituation())));
            vo.setPregnantEmotionList(selectPregnantEmotionList(checkNull(basicInformation.getPregnantEmotion())));
            vo.setProductionSpecialSituationList(selectProductionSpecialSituationList(checkNull(basicInformation.getProductionSpecialSituation())));
            vo.setAfterProductionSituationList(selectAfterProductionSituationList(checkNull(basicInformation.getAfterProductionSituation())));
            vo.setMainCaregiverList(selectMainCaregiverList(checkNull(basicInformation.getMainCaregiver())));
            vo.setAccidentPhysicalInjuryList(selectAccidentPhysicalInjuryList(checkNull(basicInformation.getAccidentPhysicalInjury())));
            vo.setAccidentFamilyChangesList(selectAccidentFamilyChangesList(checkNull(basicInformation.getAccidentFamilyChanges())));
            vo.setOneTypeVaccinesList(selectOneTypeVaccinesList(checkNull(basicInformation.getOneTypeVaccines())));
            vo.setTwoTypeVaccinesList(selectTwoTypeVaccinesList(checkNull(basicInformation.getTwoTypeVaccines())));
            vo.setFoodAllergyList(selectFoodAllergyList(checkNull(basicInformation.getFoodAllergy())));
            vo.setBreathAllergyList(selectBreathAllergyList(checkNull(basicInformation.getBreathAllergy())));
            vo.setContactAllergyList(selectContactAllergyList(checkNull(basicInformation.getContactAllergy())));
            vo.setLimbDeletionList(selectLimbDeletionList(checkNull(basicInformation.getLimbDeletion())));
            vo.setMedicalExaminationList(selectMedicalExaminationList(checkNull(basicInformation.getMedicalExamination())));
        }
        return vo;
    }

    @Override
    public int saveInformation(BasicInformation basicInformation) {
        BasicInformation oldBasicInformation = basicInformationMapper.selectByChildId(basicInformation.getChildId());
        if (null == oldBasicInformation) {
            basicInformationMapper.insert(basicInformation);
        } else {
            oldBasicInformation.setParentName(basicInformation.getParentName());
            oldBasicInformation.setParentPhone(basicInformation.getParentPhone());
            oldBasicInformation.setParentAge(basicInformation.getParentAge());
            oldBasicInformation.setParentJob(basicInformation.getParentJob());
            oldBasicInformation.setLearnSituation(basicInformation.getLearnSituation());
            oldBasicInformation.setLearnSituationRemark(basicInformation.getLearnSituationRemark());
            oldBasicInformation.setFamilySort(basicInformation.getFamilySort());
            oldBasicInformation.setMainLanguage(basicInformation.getMainLanguage());
            oldBasicInformation.setMainLanguageRemark(basicInformation.getMainLanguageRemark());
            oldBasicInformation.setMedicalDiagnosis(basicInformation.getMedicalDiagnosis());
            oldBasicInformation.setMedicalDiagnosisRemark(basicInformation.getMedicalDiagnosisRemark());
            oldBasicInformation.setFamilyHereditaryDisease(basicInformation.getFamilyHereditaryDisease());
            oldBasicInformation.setHereditaryDiseaseRemark(basicInformation.getHereditaryDiseaseRemark());
            oldBasicInformation.setPregnantSituation(basicInformation.getPregnantSituation());
            oldBasicInformation.setPregnantMedicine(basicInformation.getPregnantMedicine());
            oldBasicInformation.setPregnantSituationRemark(basicInformation.getPregnantSituationRemark());
            oldBasicInformation.setAbnormalThyroidFunction(basicInformation.getAbnormalThyroidFunction());
            oldBasicInformation.setPregnantEmotion(basicInformation.getPregnantEmotion());
            oldBasicInformation.setPregnantEmotionRemark(basicInformation.getPregnantEmotionRemark());
            oldBasicInformation.setProductionMethod(basicInformation.getProductionMethod());
            oldBasicInformation.setProductionSpecialSituation(basicInformation.getProductionSpecialSituation());
            oldBasicInformation.setAfterProductionSituation(basicInformation.getAfterProductionSituation());
            oldBasicInformation.setAfterProductionRemark(basicInformation.getAfterProductionRemark());
            oldBasicInformation.setMainCaregiver(basicInformation.getMainCaregiver());
            oldBasicInformation.setAccidentPhysicalInjury(basicInformation.getAccidentPhysicalInjury());
            oldBasicInformation.setPhysicalInjuryRemark(basicInformation.getPhysicalInjuryRemark());
            oldBasicInformation.setAccidentFamilyChanges(basicInformation.getAccidentFamilyChanges());
            oldBasicInformation.setFamilyChangesRemark(basicInformation.getFamilyChangesRemark());
            oldBasicInformation.setOneTypeVaccines(basicInformation.getOneTypeVaccines());
            oldBasicInformation.setTwoTypeVaccines(basicInformation.getTwoTypeVaccines());
            oldBasicInformation.setOtherVaccines(basicInformation.getOtherVaccines());
            oldBasicInformation.setFoodAllergy(basicInformation.getFoodAllergy());
            oldBasicInformation.setFoodAllergyRemark(basicInformation.getFoodAllergyRemark());
            oldBasicInformation.setBreathAllergy(basicInformation.getBreathAllergy());
            oldBasicInformation.setBreathAllergyRemark(basicInformation.getBreathAllergyRemark());
            oldBasicInformation.setContactAllergy(basicInformation.getContactAllergy());
            oldBasicInformation.setContactAllergyRemark(basicInformation.getContactAllergyRemark());
            oldBasicInformation.setLimbDeletion(basicInformation.getLimbDeletion());
            oldBasicInformation.setLimbDeletionRemark(basicInformation.getLimbDeletionRemark());
            oldBasicInformation.setMedicalExamination(basicInformation.getMedicalExamination());
            oldBasicInformation.setMedicalExaminationRemark(basicInformation.getMedicalExaminationRemark());
            basicInformationMapper.updateById(basicInformation);
        }
        return 1;
    }

    //核磁 CT 行为筛查 听统筛查 发育水平评估 其他
    private List<CheckDTO> selectMedicalExaminationList(String medicalExamination) {
        List<CheckDTO> medicalExaminationList = new ArrayList<>();
        String[] medicalExaminationStr = medicalExamination.split(",");
        medicalExaminationList.add(new CheckDTO("116", "核磁", checkStatus(medicalExaminationStr, "116")));
        medicalExaminationList.add(new CheckDTO("117", "CT", checkStatus(medicalExaminationStr, "117")));
        medicalExaminationList.add(new CheckDTO("118", "行为筛查", checkStatus(medicalExaminationStr, "118")));
        medicalExaminationList.add(new CheckDTO("119", "听统筛查", checkStatus(medicalExaminationStr, "119")));
        medicalExaminationList.add(new CheckDTO("120", "发育水平评估", checkStatus(medicalExaminationStr, "120")));
        medicalExaminationList.add(new CheckDTO("121", "其他", checkStatus(medicalExaminationStr, "121")));
        return medicalExaminationList;
    }

    //面部（五官） 上肢 手指 下肢 脚趾 其他
    private List<CheckDTO> selectLimbDeletionList(String limbDeletion) {
        List<CheckDTO> limbDeletionList = new ArrayList<>();
        String[] limbDeletionStr = limbDeletion.split(",");
        limbDeletionList.add(new CheckDTO("110", "面部（五官）", checkStatus(limbDeletionStr, "110")));
        limbDeletionList.add(new CheckDTO("111", "上肢", checkStatus(limbDeletionStr, "111")));
        limbDeletionList.add(new CheckDTO("112", "手指", checkStatus(limbDeletionStr, "112")));
        limbDeletionList.add(new CheckDTO("113", "下肢", checkStatus(limbDeletionStr, "113")));
        limbDeletionList.add(new CheckDTO("114", "脚趾", checkStatus(limbDeletionStr, "114")));
        limbDeletionList.add(new CheckDTO("115", "其他", checkStatus(limbDeletionStr, "115")));
        return limbDeletionList;
    }

    //紫外线 洗洁精 特定金属制品 化纤制品 其他
    private List<CheckDTO> selectContactAllergyList(String contactAllergy) {
        List<CheckDTO> contactAllergyList = new ArrayList<>();
        String[] contactAllergyStr = contactAllergy.split(",");
        contactAllergyList.add(new CheckDTO("105", "紫外线", checkStatus(contactAllergyStr, "105")));
        contactAllergyList.add(new CheckDTO("106", "洗洁精", checkStatus(contactAllergyStr, "106")));
        contactAllergyList.add(new CheckDTO("107", "特定金属制品", checkStatus(contactAllergyStr, "107")));
        contactAllergyList.add(new CheckDTO("108", "化纤制品", checkStatus(contactAllergyStr, "108")));
        contactAllergyList.add(new CheckDTO("109", "其他", checkStatus(contactAllergyStr, "109")));
        return contactAllergyList;
    }

    //扬尘 尘螨 香精 花粉 其他 备注
    private List<CheckDTO> selectBreathAllergyList(String breathAllergy) {
        List<CheckDTO> breathAllergyList = new ArrayList<>();
        String[] breathAllergyStr = breathAllergy.split(",");
        breathAllergyList.add(new CheckDTO("100", "扬尘", checkStatus(breathAllergyStr, "100")));
        breathAllergyList.add(new CheckDTO("101", "尘螨", checkStatus(breathAllergyStr, "101")));
        breathAllergyList.add(new CheckDTO("102", "香精", checkStatus(breathAllergyStr, "102")));
        breathAllergyList.add(new CheckDTO("103", "花粉", checkStatus(breathAllergyStr, "103")));
        breathAllergyList.add(new CheckDTO("104", "其他", checkStatus(breathAllergyStr, "104")));
        return breathAllergyList;
    }

    //鸡蛋 牛奶 坚果 花生 黄豆 鱼 大米 其他
    private List<CheckDTO> selectFoodAllergyList(String foodAllergy) {
        List<CheckDTO> foodAllergyList = new ArrayList<>();
        String[] foodAllergyStr = foodAllergy.split(",");
        foodAllergyList.add(new CheckDTO("92", "鸡蛋", checkStatus(foodAllergyStr, "92")));
        foodAllergyList.add(new CheckDTO("93", "牛奶", checkStatus(foodAllergyStr, "93")));
        foodAllergyList.add(new CheckDTO("94", "坚果", checkStatus(foodAllergyStr, "94")));
        foodAllergyList.add(new CheckDTO("95", "花生", checkStatus(foodAllergyStr, "95")));
        foodAllergyList.add(new CheckDTO("96", "黄豆", checkStatus(foodAllergyStr, "96")));
        foodAllergyList.add(new CheckDTO("97", "鱼", checkStatus(foodAllergyStr, "97")));
        foodAllergyList.add(new CheckDTO("98", "大米", checkStatus(foodAllergyStr, "98")));
        foodAllergyList.add(new CheckDTO("99", "其他", checkStatus(foodAllergyStr, "99")));
        return foodAllergyList;
    }

    //流脑疫苗 麻腮风三联 水痘 肺炎球菌 流感 甲肝疫苗
    private List<CheckDTO> selectTwoTypeVaccinesList(String twoTypeVaccines) {
        List<CheckDTO> twoTypeVaccinesList = new ArrayList<>();
        String[] twoTypeVaccinesStr = twoTypeVaccines.split(",");
        twoTypeVaccinesList.add(new CheckDTO("86", "流脑疫苗", checkStatus(twoTypeVaccinesStr, "86")));
        twoTypeVaccinesList.add(new CheckDTO("87", "麻腮风三联", checkStatus(twoTypeVaccinesStr, "87")));
        twoTypeVaccinesList.add(new CheckDTO("88", "水痘", checkStatus(twoTypeVaccinesStr, "88")));
        twoTypeVaccinesList.add(new CheckDTO("89", "肺炎球菌", checkStatus(twoTypeVaccinesStr, "89")));
        twoTypeVaccinesList.add(new CheckDTO("90", "流感", checkStatus(twoTypeVaccinesStr, "90")));
        twoTypeVaccinesList.add(new CheckDTO("91", "甲肝疫苗", checkStatus(twoTypeVaccinesStr, "91")));
        return twoTypeVaccinesList;
    }

    //卡介苗 脊髓灰质炎疫苗 麻疹疫苗 百白破疫苗 乙肝疫苗
    private List<CheckDTO> selectOneTypeVaccinesList(String oneTypeVaccines) {
        List<CheckDTO> oneTypeVaccinesList = new ArrayList<>();
        String[] oneTypeVaccinesStr = oneTypeVaccines.split(",");
        oneTypeVaccinesList.add(new CheckDTO("81", "卡介苗", checkStatus(oneTypeVaccinesStr, "81")));
        oneTypeVaccinesList.add(new CheckDTO("82", "脊髓灰质炎疫苗", checkStatus(oneTypeVaccinesStr, "82")));
        oneTypeVaccinesList.add(new CheckDTO("83", "麻疹疫苗", checkStatus(oneTypeVaccinesStr, "83")));
        oneTypeVaccinesList.add(new CheckDTO("84", "百白破疫苗", checkStatus(oneTypeVaccinesStr, "84")));
        oneTypeVaccinesList.add(new CheckDTO("85", "乙肝疫苗", checkStatus(oneTypeVaccinesStr, "85")));
        return oneTypeVaccinesList;
    }

    //父母离异 亲人去世 其他
    private List<CheckDTO> selectAccidentFamilyChangesList(String accidentFamilyChanges) {
        List<CheckDTO> accidentFamilyChangesList = new ArrayList<>();
        String[] accidentFamilyChangesStr = accidentFamilyChanges.split(",");
        accidentFamilyChangesList.add(new CheckDTO("78", "父母离异", checkStatus(accidentFamilyChangesStr, "78")));
        accidentFamilyChangesList.add(new CheckDTO("79", "亲人去世", checkStatus(accidentFamilyChangesStr, "79")));
        accidentFamilyChangesList.add(new CheckDTO("80", "其他", checkStatus(accidentFamilyChangesStr, "80")));
        return accidentFamilyChangesList;
    }

    private List<CheckDTO> selectAccidentPhysicalInjuryList(String accidentPhysicalInjury) {
        List<CheckDTO> accidentPhysicalInjuryList = new ArrayList<>();
        String[] accidentPhysicalInjuryStr = accidentPhysicalInjury.split(",");
        accidentPhysicalInjuryList.add(new CheckDTO("74", "严重摔伤", checkStatus(accidentPhysicalInjuryStr, "74")));
        accidentPhysicalInjuryList.add(new CheckDTO("75", "休克", checkStatus(accidentPhysicalInjuryStr, "75")));
        accidentPhysicalInjuryList.add(new CheckDTO("76", "癫痫", checkStatus(accidentPhysicalInjuryStr, "76")));
        accidentPhysicalInjuryList.add(new CheckDTO("77", "其他", checkStatus(accidentPhysicalInjuryStr, "77")));
        return accidentPhysicalInjuryList;
    }


    private List<CheckDTO> selectMainCaregiverList(String mainCaregiver) {
        List<CheckDTO> mainCaregiverList = new ArrayList<>();
        String[] mainCaregiverStr = mainCaregiver.split(",");
        mainCaregiverList.add(new CheckDTO("69", "保姆", checkStatus(mainCaregiverStr, "69")));
        mainCaregiverList.add(new CheckDTO("70", "亲生父母", checkStatus(mainCaregiverStr, "70")));
        mainCaregiverList.add(new CheckDTO("71", "养父母", checkStatus(mainCaregiverStr, "71")));
        mainCaregiverList.add(new CheckDTO("72", "爷爷奶奶", checkStatus(mainCaregiverStr, "72")));
        mainCaregiverList.add(new CheckDTO("73", "外公外婆", checkStatus(mainCaregiverStr, "73")));
        return mainCaregiverList;
    }


    private List<CheckDTO> selectAfterProductionSituationList(String afterProductionSituation) {
        List<CheckDTO> afterProductionSituationList = new ArrayList<>();
        String[] afterProductionSituationStr = afterProductionSituation.split(",");
        afterProductionSituationList.add(new CheckDTO("65", "产后抑郁", checkStatus(afterProductionSituationStr, "65")));
        afterProductionSituationList.add(new CheckDTO("66", "产后大出血", checkStatus(afterProductionSituationStr, "66")));
        afterProductionSituationList.add(new CheckDTO("67", "产后精神病", checkStatus(afterProductionSituationStr, "67")));
        afterProductionSituationList.add(new CheckDTO("68", "其他", checkStatus(afterProductionSituationStr, "68")));
        return afterProductionSituationList;
    }


    private List<CheckDTO> selectProductionSpecialSituationList(String productionSpecialSituation) {
        List<CheckDTO> productionSpecialSituationList = new ArrayList<>();
        String[] productionSpecialSituationStr = productionSpecialSituation.split(",");
        productionSpecialSituationList.add(new CheckDTO("56", "缺氧难产", checkStatus(productionSpecialSituationStr, "56")));
        productionSpecialSituationList.add(new CheckDTO("57", "脐带绕颈", checkStatus(productionSpecialSituationStr, "57")));
        productionSpecialSituationList.add(new CheckDTO("58", "胎儿过大", checkStatus(productionSpecialSituationStr, "58")));
        productionSpecialSituationList.add(new CheckDTO("59", "宫缩乏力", checkStatus(productionSpecialSituationStr, "59")));
        productionSpecialSituationList.add(new CheckDTO("60", "胎盘早期剥离", checkStatus(productionSpecialSituationStr, "60")));
        productionSpecialSituationList.add(new CheckDTO("61", "产程延长", checkStatus(productionSpecialSituationStr, "61")));
        productionSpecialSituationList.add(new CheckDTO("62", "胎膜早破", checkStatus(productionSpecialSituationStr, "62")));
        productionSpecialSituationList.add(new CheckDTO("63", "宫内感染", checkStatus(productionSpecialSituationStr, "63")));
        productionSpecialSituationList.add(new CheckDTO("64", "羊水栓塞", checkStatus(productionSpecialSituationStr, "64")));
        return productionSpecialSituationList;
    }

    private List<CheckDTO> selectPregnantEmotionList(String pregnantEmotion) {
        List<CheckDTO> pregnantEmotionList = new ArrayList<>();
        String[] pregnantEmotionStr = pregnantEmotion.split(",");
        pregnantEmotionList.add(new CheckDTO("45", "焦虑", checkStatus(pregnantEmotionStr, "45")));
        pregnantEmotionList.add(new CheckDTO("46", "抑郁", checkStatus(pregnantEmotionStr, "46")));
        pregnantEmotionList.add(new CheckDTO("47", "烦躁", checkStatus(pregnantEmotionStr, "47")));
        pregnantEmotionList.add(new CheckDTO("48", "依赖", checkStatus(pregnantEmotionStr, "48")));
        pregnantEmotionList.add(new CheckDTO("49", "易激惹", checkStatus(pregnantEmotionStr, "49")));
        pregnantEmotionList.add(new CheckDTO("50", "不安", checkStatus(pregnantEmotionStr, "50")));
        pregnantEmotionList.add(new CheckDTO("51", "恐惧", checkStatus(pregnantEmotionStr, "51")));
        pregnantEmotionList.add(new CheckDTO("52", "其他", checkStatus(pregnantEmotionStr, "52")));
        return pregnantEmotionList;
    }

    private List<CheckDTO> selectPregnantSituationList(String pregnantSituation) {
        List<CheckDTO> pregnantSituationList = new ArrayList<>();
        String[] pregnantSituationStr = pregnantSituation.split(",");
        pregnantSituationList.add(new CheckDTO("35", "先兆流产", checkStatus(pregnantSituationStr, "35")));
        pregnantSituationList.add(new CheckDTO("36", "严重孕吐", checkStatus(pregnantSituationStr, "36")));
        pregnantSituationList.add(new CheckDTO("37", "妊娠高血糖", checkStatus(pregnantSituationStr, "37")));
        pregnantSituationList.add(new CheckDTO("38", "妊娠高血压", checkStatus(pregnantSituationStr, "38")));
        pregnantSituationList.add(new CheckDTO("39", "孕期出血", checkStatus(pregnantSituationStr, "39")));
        pregnantSituationList.add(new CheckDTO("40", "孕期严重贫血", checkStatus(pregnantSituationStr, "40")));
        pregnantSituationList.add(new CheckDTO("41", "孕期服药", checkStatus(pregnantSituationStr, "41")));
        pregnantSituationList.add(new CheckDTO("42", "甲状腺功能异常", checkStatus(pregnantSituationStr, "42")));
        pregnantSituationList.add(new CheckDTO("43", "孕期饮酒或抽烟", checkStatus(pregnantSituationStr, "43")));
        pregnantSituationList.add(new CheckDTO("44", "其他", checkStatus(pregnantSituationStr, "44")));
        return pregnantSituationList;
    }

    /**
     * 主要语言
     *
     * @param mainLanguage
     * @return
     */
    private List<CheckDTO> selectMainLanguageList(String mainLanguage) {
        List<CheckDTO> mainLanguageList = new ArrayList<>();
        String[] mainLanguageStr = mainLanguage.split(",");
        mainLanguageList.add(new CheckDTO("1", "普通话", checkStatus(mainLanguageStr, "1")));
        mainLanguageList.add(new CheckDTO("2", "方言", checkStatus(mainLanguageStr, "2")));
        mainLanguageList.add(new CheckDTO("3", "其他", checkStatus(mainLanguageStr, "3")));
        return mainLanguageList;
    }

    private List<CheckDTO> selectMedicalDiagnosisList(String medicalDiagnosis) {
        List<CheckDTO> mainLanguageList = new ArrayList<>();
        String[] medicalDiagnosisStr = medicalDiagnosis.split(",");
        mainLanguageList.add(new CheckDTO("25", "未诊断", checkStatus(medicalDiagnosisStr, "25")));
        mainLanguageList.add(new CheckDTO("26", "自闭症倾向", checkStatus(medicalDiagnosisStr, "26")));
        mainLanguageList.add(new CheckDTO("27", "自闭症谱系障碍", checkStatus(medicalDiagnosisStr, "27")));
        mainLanguageList.add(new CheckDTO("28", "艾斯伯格综合征", checkStatus(medicalDiagnosisStr, "28")));
        mainLanguageList.add(new CheckDTO("29", "发育迟缓(包括语言、社交性迟缓)", checkStatus(medicalDiagnosisStr, "29")));
        mainLanguageList.add(new CheckDTO("30", "智力发育障碍", checkStatus(medicalDiagnosisStr, "30")));
        mainLanguageList.add(new CheckDTO("31", "学习障碍", checkStatus(medicalDiagnosisStr, "31")));
        mainLanguageList.add(new CheckDTO("32", "语言障碍", checkStatus(medicalDiagnosisStr, "32")));
        mainLanguageList.add(new CheckDTO("33", "情绪行为障碍", checkStatus(medicalDiagnosisStr, "33")));
        mainLanguageList.add(new CheckDTO("34", "其他", checkStatus(medicalDiagnosisStr, "34")));
        return mainLanguageList;
    }

    /**
     * 哮喘 先天性聋哑 精神分裂症 智力障碍 心脏病 糖尿病 白化病
     * 高血脂 高血压 血友病 其他 备注：
     *
     * @param familyHereditaryDisease
     * @return
     */
    private List<CheckDTO> selectFamilyHereditaryDiseaseList(String familyHereditaryDisease) {
        List<CheckDTO> familyHereditaryDiseaseList = new ArrayList<>();
        String[] familyHereditaryDiseaseStr = familyHereditaryDisease.split(",");
        familyHereditaryDiseaseList.add(new CheckDTO("4", "哮喘", checkStatus(familyHereditaryDiseaseStr, "4")));
        familyHereditaryDiseaseList.add(new CheckDTO("5", "先天性聋哑", checkStatus(familyHereditaryDiseaseStr, "5")));
        familyHereditaryDiseaseList.add(new CheckDTO("6", "精神分裂症", checkStatus(familyHereditaryDiseaseStr, "6")));
        familyHereditaryDiseaseList.add(new CheckDTO("7", "智力障碍", checkStatus(familyHereditaryDiseaseStr, "7")));
        familyHereditaryDiseaseList.add(new CheckDTO("8", "心脏病", checkStatus(familyHereditaryDiseaseStr, "8")));
        familyHereditaryDiseaseList.add(new CheckDTO("9", "糖尿病", checkStatus(familyHereditaryDiseaseStr, "9")));
        familyHereditaryDiseaseList.add(new CheckDTO("10", "白化病", checkStatus(familyHereditaryDiseaseStr, "10")));
        familyHereditaryDiseaseList.add(new CheckDTO("11", "高血脂", checkStatus(familyHereditaryDiseaseStr, "11")));
        familyHereditaryDiseaseList.add(new CheckDTO("12", "高血压", checkStatus(familyHereditaryDiseaseStr, "12")));
        familyHereditaryDiseaseList.add(new CheckDTO("13", "血友病", checkStatus(familyHereditaryDiseaseStr, "13")));
        familyHereditaryDiseaseList.add(new CheckDTO("14", "其他", checkStatus(familyHereditaryDiseaseStr, "14")));
        return familyHereditaryDiseaseList;
    }

    private Boolean checkStatus(String[] str, String id) {
        for (String remark : str) {
            if (remark.equals(id)) {
                return Boolean.TRUE;
            }
        }
        return Boolean.FALSE;
    }

    private String checkNull(String params) {
        if (StringUtils.isNotEmpty(params)) {
            return params;
        }
        return "";
    }

}
